package main

import (
	"fmt"
	"reflect"
	"strconv"
)

// 一些定义
func someVar() {
	fmt.Println()
	fmt.Println("=========someVar========")
	fmt.Println()
	var age int
	var name = "String" + "name"
	fmt.Println(age)
	fmt.Println(name)

	var stock = 123
	var enddate = "2021-09-11"
	var url = "code=%d&endDate=%s"
	var target_url = fmt.Sprintf(url, stock, enddate)
	fmt.Println(target_url)

	// 强转

	// int转float强转
	int1 := 7
	int2 := 15
	var float1 float64
	float1 = float64(int2) / float64(int1)
	fmt.Println(float1)

	// 返回int error
	inta, _ := strconv.Atoi("1")
	fmt.Println(inta)
	// 返回string
	stringa := strconv.Itoa(inta)
	fmt.Println(stringa)
	// int string
	fmt.Println(reflect.TypeOf(inta), reflect.TypeOf(stringa))
}
